<template>
  <div id="app">
    <router-view v-if="!loading" />
    <div v-else class="loading">
      <p>加载中...</p>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'

const loading = ref(true)
const router = useRouter()

onMounted(() => {
  // 监听路由准备完成
  router.isReady().then(() => {
    loading.value = false
  })
})
</script>

<style>
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}
</style>
